@extends('admin.layouts._menu')
@section('content')
    <form action="{{route('admin.user.role',$user)}}" method="post">
        @csrf
        <h4 class="text-secondary">编辑 [{{$user['name']}}] 用户角色</h4>
        @foreach($roles as $role)
            <div class="card-body">
                <div class="col-4 mb-2">
                    @if($user->hasRole($role['name']))
                        <input type="checkbox" name="roles[]" checked value="{{$role['name']}}">
                    @else
                        <input type="checkbox" name="roles[]"  value="{{$role['name']}}">
                    @endif
                    {{$role['title']}}[{{$role['name']}}]
                </div>
            </div>
        @endforeach
        <button class="btn btn-primary btn-sm">保存提交</button>
    </form>
@endsection
